﻿using Tfs.OnTheRoad.Commands;
using Tfs.OnTheRoad.Model;
namespace Tfs.OnTheRoad.ViewModel
{
    /// <summary>
    /// Build List ViewModel
    /// </summary>
    public class BuildListViewModel : BaseListViewModel<Build>
    {
        public NavigateToBuildCommand NavigateToBuild
        {
            get;
            private set;
        }

        private Project _currentProject;

        public Project CurrentProject
        {
            get { return _currentProject; }
            set { _currentProject = value; }
        }

        public BuildListViewModel(Model.Project project)
            : base()
        {
            NavigateToBuild = new NavigateToBuildCommand();
            _currentProject = project;
            PageTitle = "Builds";
            Query = string.Format("Project eq '{0}'", project.Name);
            OrderBy = "FinishTime desc";
        }

        public BuildListViewModel(string path)
            : base(path)
        {
        }

        public override string GetNoResultsFoundMessage()
        {
            return "No builds were found.";
        }

        public override string GetEntityCollectionName()
        {
            return "Builds";
        }
    }
}
